const Promise = require('bluebird');

/**
 * schedule
 */
exports.schedule = function ({query, body}, {schedule}) {
    let {action, method} = query;
    return schedule[action] && schedule[action][method] && schedule[action][method](body) || {success: false};
};

/**
 * tasks
 */
exports.tasks = function ({query, body}, {tasks}) {
    let {method} = query;
    return tasks[method] && tasks[method](body) || {success: false};
};